package com.qztech.sdk.model.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.qztech.sdk.model.entities.SummingChannel;
import com.qztech.sdk.model.entities.SummingSetting;

import java.util.List;

/**
 * @author:zhanghb
 * @date:2019/1/27
 * @email:2573475062@qq.com
 **/
@Dao
public interface SummingDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(List<SummingChannel> summingChannels);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insert(SummingSetting summingSetting);

    @Update
    void update(SummingChannel summingChannel);

    @Delete
    void delete(SummingChannel summingChannel);

    @Delete
    void delete(SummingSetting summingSetting);

    @Query("delete from su_channel where setting_id=:settingId")
    void delete(String settingId);

    @Query("Select * from su_channel where setting_id=:settingId")
    List<SummingChannel> getSummingChannelList(String settingId);

    @Query("Select * from su_setting where p_id=:pid")
    SummingSetting getSummingSetting(String pid);
}
